package orthoplanner.com.google.code.ui;

import java.awt.Color;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JPanel;

import orthoplanner.com.google.code.eventhandlers.ImageBrowseHandler;


public class ControlPanel extends JPanel {
	private static final long serialVersionUID = 6458130732195541764L;
	private JButton bImage;
	private JPanel imgControlPanel, lineControlPanel, exportControlPanel;

	public ControlPanel(ImageViewer imgViewer) {
		bImage = new JButton("Load X-Ray");
		bImage.addMouseListener(new ImageBrowseHandler(imgViewer));
		imgControlPanel = new ImageControlPanel(imgViewer);
		lineControlPanel = new LineControlPanel(imgViewer);
		exportControlPanel = new ExportControlPanel(imgViewer);

		setLayout(new GridBagLayout());
		GridBagConstraints gbc = new GridBagConstraints();
		gbc.insets = new Insets(5, 5, 5, 5);
		gbc.weightx = 1.0;
		gbc.weighty = 1.0;
		gbc.ipady = 10;
		gbc.insets = new Insets(20, 5, 5, 5);
		gbc.anchor = GridBagConstraints.PAGE_START;
		add(bImage, gbc);
		gbc.fill = GridBagConstraints.BOTH;
		gbc.gridy = 1;

		add(imgControlPanel, gbc);
		gbc.gridy = 2;
		add(lineControlPanel, gbc);
		gbc.gridy = 3;
		add(exportControlPanel, gbc);

		setBorder(BorderFactory.createLineBorder(Color.black));
		bImage.setFont( new Font("SansSerif", Font.BOLD, 12));
	}

}
